﻿//Copyright (C) <2013>  <jonathan cleeve norton> All Rights Reserved 
//Contact jon.norton@fin-plus.co.uk website <http://www.fin-plus.co.uk/>
using FinPlusInterfaces;
using FinPlusCompCore;

namespace FinPlusCompProxy
{
    public class BondRate : IRate
    {
        public double Value { get { return _level.Value; } }
        public int Shock { get; set; }
        public string Instrument { get; set; }

        private enum Params { ShockUnit }
        private FinPlusLevel _level;
        private QLAnalytics _analytics;
        private IPod _instrumentBuild, _instrument;
        private string _instrumentName;
        private double _shockUnit;

        public BondRate(QLAnalytics analytics, string instrumentName, IPod instrument, IPod instrumentBuild)
        {
            _analytics = analytics;
            _instrumentName = instrumentName;
            _instrument = instrument;
            _instrumentBuild = instrumentBuild;
            _level = new FinPlusLevel(analytics.BuySell);
            _shockUnit = (double)_instrument.Get(Params.ShockUnit.ToString()).Object;
        }

        public string Build(string buySell)
        {
            //TODO adj re ZCM if shock
            return _instrumentName;
        }

        public bool Update(IPod level)
        {
            return _level.LevelUpdate(level);
        }
    }
}
